<template>
  <div class="nav">
    <router-link to="/authentication">
        <img src="../../image/doctor1.png" alt="">
      <div>
        <div>医师认证</div>
        <div>PHYSICIAN</div>
      </div>
    </router-link>
    <router-link to="/myCollect">
        
        <img src="../../image/icon_collect_my.png" alt="">
      <div>
        <div>我的收藏</div>
        <div>MY COLLECT</div>
      </div>

    </router-link>
  </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        userid: '',
        usertype: "", // 判断用户是否通过医师认证 如果通过就是doctor
      }
    },
    methods: {
      justUserType() { //判断用户是否通过医生认证
        this.userid = localStorage.getItem("loginMobile");
        if (this.userid) {
          this.$api.get(this.$api.baseURLSchool, "select_cid/user/" + this.userid, {}, r => {
            // console.log(r);
            if (r.data.ret == 1) {
              if (r.data.info.per_app_status == "1") {
                this.usertype = "doctor";
              }
            }
          }, err => {
            console.log(err);
          })
        }

      },
      //点滴积累 只有医生能做
      goDailyProblem() {
        //判断用户是否认证 如果认证审核通过
        if (this.usertype == 'doctor') {
          this.$router.push({
            name: 'dailyProblem'
          });
        } else {
          this.$router.push({
            name: 'authentication'
          });
        }
      },

    },
    created() {
      this.justUserType();
    }
  }

</script>
<style lang="scss">
</style>
